package cn.zqy.demo2.day01.demo02;


import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

/**
 * 计算出生多少天
 * */
public class Demo03DateBirthday {
    public static void main(String[] args) throws ParseException {
        long now = new Date().getTime();
        long before;
        SimpleDateFormat a = new SimpleDateFormat("y-M-d");
        System.out.println("请输入出生日：y-m-d");
        String sc = new Scanner(System.in).next();
        Date beforeObj = a.parse(sc);
        before = beforeObj.getTime();
        long dayMilli = now - before;
        long day = dayMilli / (24 * 60 * 60 * 1000);
        System.out.println(day);
    }
}
